package com.fwtai.api.controller;

import com.fwtai.service.api.ApiUserService;
import com.fwtai.tool.ToolClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * 小程序|移动端登录,含验证码登录
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2020-07-17 15:08
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Api(tags = "登录认证,toekn不填",description = "小程序登录功能")
@RestController
public class UserAuthController{

  @Autowired
  private ApiUserService apiUserService;

  //手机号和密码登录
  @ApiOperation(value = "手机号和密码登录",notes = "要求输入账号(手机号)、登录密码、type登录类型1为android;2为ios;3为小程序<br/>" +
    "返回数据若没有info字段信息说明是账号信息尚未完善,若有info里的type->1普通账号;2是律师;3是企业;")
  @ApiImplicitParams({
    @ApiImplicitParam(name = "username", value = "登录账号(手机号)", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "password", value = "登录密码", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "type", value = "登录类型: 1为android;2为ios;3为小程序", dataType = "int", paramType = "query", required = true, defaultValue = "3")
  })
  @PostMapping(value = "/login")
  public void login(final HttpServletResponse response){
    ToolClient.responseJson(ToolClient.createJsonSuccess("操作成功"),response);
  }
}